import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SSeqPetAttributeUpdate } from "../../../../../Message/Public/SSeqPetAttributeUpdate";
import { SAttributeUpdate } from "../../../../../Message/Public/SAttributeUpdate";
import { EEntityAttribute } from "../../../../../Message/Public/EEntityAttribute";
import { SPetInfo } from "../../../../../Message/Game/SPetInfo";
type int = number;
//class PetAttrUpdateCommand
    
    export  class PetAttrUpdateCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            var loc2=null;
            var loc1=arg1.messageBase as SSeqPetAttributeUpdate;
            this._uid = loc1.uid;
            this._updateCode = loc1.code;
            this._petInfo = _cache.pet.getPetInfoByUid(this._uid);
            if (this._petInfo) 
            {
                var loc3=0;
                var loc4=loc1.updates;
                for(loc2 of loc4) 
                {
                    this.petInfoUpdate(loc2);
                }
            }
            return;
        }

        /* internal  */petInfoUpdate(arg1: SAttributeUpdate): void
        {
            var loc1=arg1.attribute.__value;
            switch (loc1) 
            {
                case EEntityAttribute._EAttributeExperience:
                {
                    this._petInfo.experience = parseFloat(arg1.valueStr);
                    break;
                }
            }
            return;
        }

        private /* var */_uid: string;

        private /* var */_updateCode: int;

        private /* var */_petInfo: SPetInfo;
    }
